/**
 * 社区业务
 */
const express = require('express')
const router = express.Router()
const db = require('../db/index')
// 获取导航列表数据
router.get('/navigator', (req, res) => {
    const sql = 'select *from navigatorlist';
    db.query(sql, (err, result) => {
        if (err) return res.lose(err)
        res.send({
            message: '获取社区分类数据成功',
            success: true,
            status: 0,
            result
        })
    })
})
// 获取根据导航id-详情内容
// http://127.0.0.1:3006/pics/commundetail?id=1
router.get('/commundetail', (req, res) => {
    const id = parseInt(req.query.id);
    const sql = 'select *from navigatorlist where id =?'
    db.query(sql, id, (err, result) => {
        if (err) return res.lose(err)
        res.send({
            message: '获取社区分类数据成功',
            success: true,
            status: 0,
            result
        })
    })
})

module.exports = router;